package indi.cyh.fastservice.base.entity.http;

/**
 * 请求的参数形式
 */
public enum ParamMode {
    FORM("表单参数"),
    URL("URL参数"),
    RAW("raw参数");

    private String value;

    public String getValue() {
        return value;
    }

    ParamMode(String value) {
        this.value = value;
    }

    public void setValue(String value) {
        this.value = value;
    }

    public static ParamMode getParamMode(String value) throws Exception {
        switch (value.toUpperCase()){
            case "X-WWW-FORM-URLENCODED":
                return FORM;
            case "FORM-DATA":
                return URL;
            case "RAW":
                return RAW;
            default:
                throw new Exception("未知的参数类型!");
        }
    }
}
